<?php

namespace app\api\controller;

use think\Controller;

class Student extends Controller
{
    //优秀学员
    public function student()
    {
        $student = model('common/Student')
            -> field('id,photo,sname,school,age,sex,address,score,motto')
            -> select();
        foreach($student as $v){
            if ($v->sex==1){
                $v->sex = '男';
            } else {
                $v->sex = '女';
            }
        }
        if ($student){
            return json(['code'=>100,'mag'=>'请求成功','data'=>$student]);
        } else {
            return json(['code'=>404,'msg'=>'请求失败！']);
        }
    }
}
